const Joi = require('joi')

// role模块验证规则 
// 新增
const roleAddSchema = Joi.object({
    name: Joi.string().min(1).max(30).required(),
    namecn: Joi.string().min(1).max(30).required(),
    state: Joi.boolean() 
})

// 更新 
const roleUpdateSchema = Joi.object({
    id: Joi.number().required(),
    name: Joi.string().min(1).max(30),
    namecn: Joi.string().min(1).max(30),
    state: Joi.boolean() 
})

// 分页查询 
const roleListSchema = Joi.object({
    pageSize: Joi.number(),
    currentPage: Joi.number(),
    where: Joi.object(),
    sort: Joi.object() 
})

// 删除  
const roleDeleteSchema = Joi.object({
    ids: Joi.array() 
})

exports.roleAdd = roleAddSchema 
exports.roleList = roleListSchema 
exports.roleDelete = roleDeleteSchema 
exports.roleUpdate = roleUpdateSchema 
